import request from '@/config/axios'

// 客户 VO
export interface CustomerVO {
  id: number // 参数主键
  name: string // 客户名称
  employeeCount: number // 企业人数
  companyType: string // 单位性质
  contactPerson: string // 联系人
  industryProcess: string // 企业工艺
  contactPhone: string // 联系电话
  province: string // 省份
  city: string // 城市
  district: string // 区县
  products: string // 企业产品
  address: string // 详细地址
}

// 客户 API
export const CustomerApi = {
  // 查询客户分页
  getCustomerPage: async (params: any) => {
    return await request.get({ url: `/dk/customer/page`, params })
  },
  getMyCustomerPage: async (params: any) => {
    return await request.get({ url: `/dk/customer/mypage`, params })
  },

  // 查询客户详情
  getCustomer: async (id: number) => {
    return await request.get({ url: `/dk/customer/get?id=` + id })
  },

  // 新增客户
  createCustomer: async (data: CustomerVO) => {
    return await request.post({ url: `/dk/customer/create`, data })
  },

  // 修改客户
  updateCustomer: async (data: CustomerVO) => {
    return await request.put({ url: `/dk/customer/update`, data })
  },

  // 删除客户
  deleteCustomer: async (id: number) => {
    return await request.delete({ url: `/dk/customer/delete?id=` + id })
  },

  // 导出客户 Excel
  exportCustomer: async (params) => {
    return await request.download({ url: `/dk/customer/export-excel`, params })
  },
}
